<?php

class feed_Component_Block_Form_MusicSharing extends Phpfox_Component {
    public function process(){
        $is_musicsharing = phpfox::getLib('module')->isModule('musicsharing');

        $albums = array();
        if($is_musicsharing)
        {
            phpfox::getLib('phpfox.database')->query("SET character_set_results=utf8");
            $albums = phpfox::getLib('phpfox.database')->select('*')
                            ->from(Phpfox::getT('m2bmusic_album'),'al')
                            ->where('al.user_id ='.Phpfox::getUserId())
                            ->execute('getSlaveRows');
            phpfox::getLib('phpfox.database')->query("SET character_set_results=latin1");
            foreach($albums as $key=>$value)
            {
              if(isset($value['is_delete']))
              {
                //music selling
                if($value['is_delete'] == 1)
                {
                  unset($albums[$key]);
                }
              }
            }
        }  
        $this->template()->assign(
            array(
                'albums' =>$albums,
                )
            );
    }
}